<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<title><?php echo C('defaultinfo.name');?> - Powered By 新致HRM</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		<meta name="description" content=""/>
		<meta name="author" content="HRM"/>
		<link rel="shortcut icon" href="__PUBLIC__/ico/favicon.png"/>
		<link rel="stylesheet" href="__PUBLIC__/css/bootstrap.css">
		<link rel="stylesheet" href="__PUBLIC__/css/hrms.css">
		<script src="__PUBLIC__/js/jquery.min.js"></script>
		<script src="__PUBLIC__/js/bootstrap.min.js"></script>
		<script src="__PUBLIC__/js/nongli.js"></script>
		<script src="__PUBLIC__/js/calendar.js"></script>
		<!--[if lt IE 9]>
		<script src="__PUBLIC__/js/html5shiv.min.js"></script>
		<script src="__PUBLIC__/js/respond.min.js"></script>
		<![endif]-->
	</head>
	<body>
<?php echo W('Navigation');?>
<script src="__PUBLIC__/js/datepicker/WdatePicker.js"></script>
<script charset="utf-8" src="__PUBLIC__/js/editor/kindeditor.js"></script>
<script charset="utf-8" src="__PUBLIC__/js/editor/lang/zh_CN.js"></script>
<script>
        KindEditor.ready(function(K) {
                window.editor = K.create('#content',{
			uploadJson:"<?php echo U('core/file/editor');?>"
		});
        });
</script>
<div class="body-right">
	<div class="row-table">
		<div class="row-table-title">添加员工合同</div>
		<div class="row-table-body">
			<p class="form-title"><a class="pull-right btn btn-primary btn-xs" href="<?php echo U('hrm/staffcontract/index');?>">合同列表</a>添加员工合同</p>
			<form action="<?php echo U('hrm/staffcontract/add');?>" class="form-horizontal" enctype="multipart/form-data" method="post">
				<div class="form-group">
					<label for="to_name" class="col-sm-2 control-label">员工姓名</label>
					<div class="col-sm-3">
						<input id="to_name" class="form-control" type="text" value="<?php echo ($info["user_name"]); ?>">
						<input id="to_user_id" type="hidden" name="to_user_id" value="<?php echo ($info["user_id"]); ?>">
					</div>
					<label for="type" class="col-sm-2 control-label">合同类型</label>
					<div class="col-sm-3">
						<select id="type" class="form-control" name="type">
							<option value="0">--请选择--</option>
							<?php $_result=C('contracttype');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($info['type'] == $key): ?>selected="selected"<?php endif; ?> ><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
				</div>
				<div class="form-group">
					<label for="number" class="col-sm-2 control-label">合同编号</label>
					<div class="col-sm-3">
						<input id="number" class="form-control" type="text" name="number" value="">
					</div>
					<label for="name" class="col-sm-2 control-label">合同名称</label>
					<div class="col-sm-3">
						<input id="name" class="form-control" type="text" name="name" value="<?php echo ($info["name"]); ?>">
					</div>
				</div>
				<div class="form-group">
					<label for="status" class="col-sm-2 control-label">合同状态</label>
					<div class="col-sm-3">
						<select id="status" class="form-control" name="status">
							<option value="0">--请选择--</option>
							<?php $_result=C('contractstatus');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($info['status'] == $key): ?>selected="selected"<?php endif; ?> ><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
					<label for="time_type" class="col-sm-2 control-label">期限类型</label>
					<div class="col-sm-3">
						<label class="checkbox-inline">
							<input type="radio" id="time_type" value="1" name="time_type" checked="checked">固定期限
						</label>
						<label class="checkbox-inline">
							<input type="radio" id="time_type" value="2" name="time_type">无固定期限
						</label>
					</div>
				</div>
				<div class="form-group">
					<label for="start_time" class="col-sm-2 control-label">开始时间</label>
					<div class="col-sm-3">
						<input id="start_time" class="form-control" type="text" name="start_time" value="<?php if(!empty($info["start_time"])): echo (date('Y-m-d',$info["start_time"])); endif; ?>" onclick="WdatePicker()">
					</div>
					<label for="end_time" class="col-sm-2 control-label">截止时间</label>
					<div class="col-sm-3">
						<input id="end_time" class="form-control" type="text" name="end_time" value="<?php if(!empty($info["end_time"])): echo (date('Y-m-d',$info["end_time"])); endif; ?>" onclick="WdatePicker()">
					</div>
				</div>
				<div class="form-group">
					<label for="content" class="col-sm-2 control-label">合同内容</label>
					<div class="col-sm-9">
						<textarea id="content" name="content" rows="15" class="form-control"><?php echo ($info["content"]); ?></textarea>
					</div>
				</div>
				<div class="form-group">
					<label for="content" class="col-sm-2 control-label">上传附件</label>
					<div class="col-sm-6" id="upload_file">
						<input id="file" name="file[]" type="file" /><input type="button" class="btn btn-primary btn-xs"  id="addcontractType" value="增加" />
					</div>
				</div>
				<div class="form-group">
					<label for="content" class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<input type="submit" class="btn btn-primary" value="确定" />
						&nbsp;&nbsp;<input type="button" class="btn" value="取消" onclick="javascript:history.back();"/>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<div class="clear"></div>
<script type="text/javascript">
$(function(){
	$('#to_name').click(function(){
		$('#alert').modal({
			show:true,
			remote:"<?php echo U('core/user/getuserrindex');?>"
		});
	});
	$('#addcontractType').click(function(){
		$(this).after('<input id="file" name="file[]" type="file" /><input type="button" class="btn btn-xs deletecontractType" value="[删除]" />');
	});
	$('#upload_file').on('click','.deletecontractType',function(){
		$(this).prev().remove();
		$(this).remove();
	});
});
</script>
<div class="modal fade" id="alert" tabindex="-1" data-backdrop="static">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">提示信息</h4>
			</div>
			<div class="modal-body">
			<?php if(is_array($alert)): foreach($alert as $k=>$v): if(is_array($v)): foreach($v as $kk=>$vv): ?><div class="alert alert-<?php echo ($k); ?>">
					<?php echo ($vv); ?>
				</div><?php endforeach; endif; endforeach; endif; ?>
			</div>
		</div>
	</div>
</div>
<?php if(!empty($alert)): ?><script type="text/javascript">
	$('#alert').modal('show');
	var alert_n = setInterval('$("#alert").modal("hide")',1000);
	$('#alert').on('hide.bs.modal', function (e) {
		clearInterval(alert_n);
	});
</script><?php endif; ?>
		<!-- <div id="footer">
			<div class="container">
				<p class="text-muted credit">
					HRM © 2013 <a href="http://www.ccds24.com" target="_blank">河南锐骑文化传播有限公司</a>版权所有
				</p>
			</div>
		</div> -->
	</body>
</html>